package com.xbh.boot_study.controller;

import com.xbh.boot_study.annotion.EnableLog;
import com.xbh.boot_study.entity.Teacher;
import com.xbh.boot_study.srv.HelloSrv;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

@Api("hello模块")
@RestController
@RequestMapping("/hello")
public class HelloController {

    @Autowired
    HelloSrv helloSrv;

    //@Value("#{11*2}")
    //private Integer age;
    //@Value("true")
    //private Boolean boss;
    @Value("${student.name}")
    private String value;

    @ApiImplicitParam(name = "name",value = "姓名",required = false)
    @ApiOperation(value = "向客人问好")
    @GetMapping("hello")
    public Teacher hello(@RequestParam(name = "name", required = false) String name) {

        // 创建用户逻辑



        return new Teacher().setName("李斯").setGender("nan").setId("432542342");
    }

    @GetMapping("testAsync")
    public Teacher testAsync(@RequestBody Teacher teacher) {
        return teacher.setId("1122334").setName("大傻");
    }

    @GetMapping("testPointCut")
    @EnableLog(modelName = "哈喽测试模块", behavior = "测试切点", remake = "点构成线")
    public String testPointCut() {
        System.out.println("@@@@@@@@@@@ 执行中");
        return "新年库埃洛!";
    }
}
